<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 将 object 对象中的 key 和 value 互换 -->
    <script>
        var obj = {
            value:'右',
            key:31
        }
        console.log('为转换前:');
        console.log(obj);

        var snk = obj.key;
        obj.key = obj.value;
        obj.value = snk;

        console.log('转换后:');
        console.log(obj);
    </script>
</body>
</html>